import axios from "axios"
//请求环境
const service = axios.create({
    // 判断环境
    // baseURL:  '/' ,
    //在浏览器中允许跨域携带cookie
    withCredentials: true,
    // timeout: 50000,
})
   
//get请求(get请求如果是封装好的，直接调用即可，此处是为了完整举例)
export const get=(url, data,headers)=> {
    return new Promise((resolve, reject) => {
        service({
          method: 'get',
          url,
          params: data,
          headers:headers
        })
        .then(res => {
            resolve(res)
        })
        .catch(err => {
            resolve(err)
        })
    })
}
